package com.hq.ims.userpc.controller;

import com.hq.ims.data.annotation.UserOperationMonitor;
import com.hq.ims.data.utils.LocalConstant;
import com.hq.ims.data.vo.BusInfoNotificationMapstruct;
import com.hq.ims.userpc.busservice.BusInfoNotificationService;
import com.hq.mybatis.base.page.RequestPage;
import com.hq.mybatis.base.page.ReturnPage;
import com.hq.utils.vo.ReturnVo;
import com.hq.web.annotations.GetJsonValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author cx
 * @date 2024/11/26 11:21:02
 * @description 经营信息接收Controller
 */
@Api(tags = "经营信息接收")
@RestController
@RequestMapping(LocalConstant.SYS_TYPE_USER_PC_URL_PREFIX + "/busInfoNotification")
public class BusInfoNotificationController {

    @Resource
    private BusInfoNotificationService busInfoNotificationService;

    @ApiOperation(value = "列表查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/pageList", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<ReturnPage<BusInfoNotificationMapstruct.BusInfoNotificationVo>> pageList(
            @RequestBody RequestPage<BusInfoNotificationMapstruct.BusInfoNotificationVo> page,
            @RequestBody BusInfoNotificationMapstruct.PageSearchVo param) {
        return busInfoNotificationService.pageList(page, param);
    }

    @ApiOperation(value = "详情", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getDetail", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<BusInfoNotificationMapstruct.DetailVo> getDetail(@GetJsonValue(zh = "推送id") String busInfoNotificationId) {
        return busInfoNotificationService.getDetail(busInfoNotificationId);
    }

    @UserOperationMonitor
    @ApiOperation(value = "经营信息拒收", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/rejection", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> rejection(@RequestBody @Valid BusInfoNotificationMapstruct.RejectionVo rejectionVo) {
        return busInfoNotificationService.rejection(rejectionVo);
    }

    @UserOperationMonitor
    @ApiOperation(value = "经营信息接收", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/receive", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> receive(@GetJsonValue(zh = "推送ID") String busInfoNotificationId) {
        return busInfoNotificationService.receive(busInfoNotificationId);
    }

    @UserOperationMonitor
    @ApiOperation(value = "指派经营人员", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/appointPersonnel", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> appointPersonnel(@RequestBody @Valid BusInfoNotificationMapstruct.AppointPersonnelVo appointPersonnelVo) {
        return busInfoNotificationService.appointPersonnel(appointPersonnelVo);
    }
}
